
    document.createElement("script").setAttribute("src", "ajax-poromise.js");
    let xhr = null;
    let row = document.querySelector(".row")
    if(window.XMLHttpRequest) {
        xhr = new XMLHttpRequest()
    } else {
        xhr = new ActiveXObject("micosoft.XMLHTTP")
    }
    
    xhr.open('get','http://chst.vip:1234/api/getindexmenu',true)
    
    xhr.send(null);
    
    
    xhr.onreadystatechange = function () {
       if(xhr.readyState===4 && xhr.status===200) {
            let res = JSON.parse(xhr.responseText).result
            console.log(res);
            let asd = [src="./assets/images/ic_search.png",
            src="./assets/images/ic_cu.png",
            src="./assets/images/ic_coudanpin.png",
            src="./assets/images/ic_bcj.png",
            src="./assets/images/haitao.png",
            src="./assets/images/ic_temai.png",
            src="./assets/images/ic_trend.png",
            src="./assets/images/gengduo.png",
            src="./assets/images/ic_coudanpin.png",
            src="./assets/images/ic_kb.png",
            src="./assets/images/ic_mall.png",
            src="./assets/images/ic_pp.png"]
            let data = res.map((item,index)=>{return{img:asd[index],name:item.name,titlehref:item.titlehref}})
            let html =""
            data.forEach(item => {
              html +=  `<div class="cdl">
              <a href="${item.titlehref}">
                  <span>
                  <img src="${item.img}">
                  </span>
              </a>
              <p>${item.name}</p>
          </div>`
            })
            row.innerHTML = html
       }
    }
    window.onload = function () {
        var myDiv = document.querySelector('.row')
        var div_s = myDiv.getElementsByTagName("div");
        console.log(div_s); 
            div_s[7].addEventListener('click',function() {
            var traget= div_s[8];  
            if(traget.style.display=="none"){  
                traget.style.display="block";  
            }else{  
                traget.style.display="none";  
            }
            var traget1= div_s[9];  
            if(traget1.style.display=="none"){  
                traget1.style.display="block";  
            }else{  
                traget1.style.display="none";  
            }
            var traget2= div_s[10];  
            if(traget2.style.display=="none"){  
                traget2.style.display="block";  
            }else{  
                traget2.style.display="none";  
            }
            var traget3= div_s[11];  
            if(traget3.style.display=="none"){  
                traget3.style.display="block";  
            }else{  
                traget3.style.display="none";  
            }
            })
        }